package com.ddwl.schema.bo.order;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;

import javax.validation.Valid;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.math.BigDecimal;
import java.util.List;

/**
 * @Author hemiaojun
 * @Date 2020/11/2 14:11
 */
@Getter
@Setter
@ApiModel("砍价购下单bo")
public class BargainActivityOrderBo {

    @NotNull( message = "用户不能为空")
    @ApiModelProperty("用户id")
    private String userId;

    @ApiModelProperty("用户名")
    private String userName;

    @ApiModelProperty("系统来源")
    private String product;

    @ApiModelProperty("用户收货地址ID")
    @NotNull( message = "用户收货地址不能为空")
    private String userAdderId;

    @NotNull( message = "是否零元单不能为空")
    @ApiModelProperty("是否0元单 0：否，1：是")
    private Integer zeroOrder;

    @Valid
    @NotNull( message = "商品信息不能为空")
    @Size(min = 1,message = "最少购买一个商品")
    @Size(max = 20,message = "最多一次性购买20个商品")
    @ApiModelProperty(value = "订单商品信息",required = true)
    private List<SkuList> skuLists;

    @Min(value = 0,message = "商品总价不能小于0")
    @ApiModelProperty(value = "商品总价",required = true)
    private BigDecimal price;

    @ApiModelProperty(value = "主订单id")
    private String masterOrderId;

    @ApiModelProperty(value = "订单备注")
    private String note;

    @Data
    @ApiModel("订单商品信息")
    public static class SkuList {
        @NotNull(message = "商品id不能为空")
        @ApiModelProperty(value = "商品id",required = true)
        private String itemId;

        @NotNull(message = "商品规格id不能为空")
        @ApiModelProperty(value = "商品规格id",required = true)
        private String skuId;

        @NotNull(message = "商品规格描述不能为空")
        @ApiModelProperty(value = "商品规格描述",required = true)
        private String skuDesc;

        @Min(value = 1,message = "商品最少购买一件")
        @NotNull(message = "购买数量不能为空")
        @ApiModelProperty(value = "购买数量",required = true)
        private Integer skuQty;

        @ApiModelProperty(value = "备注")
        private String remark;

        @ApiModelProperty(value = "参与的活动id")
        private String activityId;

        @ApiModelProperty(value = "供应商id")
        private String supplierId;
        @ApiModelProperty("0快递1外送2自提默认快递")
        private Integer deliveryType;

        @ApiModelProperty("用户收货地址ID")
        private String userAdderId;

        @Size(max = 15,message = "电话长度过长")
        @ApiModelProperty("自提用户联系电话")
        private String userMobile;
    }

}
